package test01;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class DateTest {
    public static void main(String[] args) {
        /*SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
        String ds = "2017-09-08 12:33:44";
        Date date= null;
        try {
            date = sdf.parse(ds);
            String ss = sdf.format(date);
            System.out.println(ss);
        } catch (ParseException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        System.out.println(date);*/
        /*add(2, 60);
        delete(62);*/
        
        for(int i=1;i<100;i++){
            int a = i;
            new Thread(new Runnable() {
                @Override
                public void run() {
                    // TODO Auto-generated method stub
                    int sum = add(a, 0);
                    delete(sum);
                }
            }).start();
        }
    }
    
    static int add(Integer a, Integer b){
        int sum = a+b;
        System.out.println(""+sum+" "+System.currentTimeMillis());
        return sum;
    }
    
    static void delete(int sum){
        String s = "11111";
        List<Map<String,String>> list = new ArrayList<Map<String,String>>();
        Map<String, String> map1 = new HashMap<String, String>();
        map1.put("111", "001");
        map1.put("222", "002");
        map1.put("333", "001");
        map1.put("444", "002");
        map1.put("555", "001");
        map1.put("666", "002");
        map1.put("777", "001");
        map1.put("888", "002");
        
        list.add(map1);
        select(s,list,sum);
    }
    
    static void select(String a,List<Map<String,String>> list,int sum){
        String s = a;
        Map<String, String> map1 = new HashMap<String, String>();
        map1.put("111", "001");
        map1.put("222", "002");
        map1.put("333", "001");
        map1.put("444", "002");
        map1.put("555", "001");
        map1.put("666", "002");
        map1.put("777", "001");
        map1.put("888", "002");
        list.add(map1);
        insert(s,list,sum);
    }
    
    static void insert(String a,List<Map<String,String>> list,int sum){
        Map<String, String> map1 = new HashMap<String, String>();
        map1.put("111", "001");
        map1.put("222", "002");
        map1.put("333", "001");
        map1.put("444", "002");
        map1.put("555", "001");
        map1.put("666", "002");
        map1.put("777", "001");
        map1.put("888", "002");
        list.add(map1);
        System.out.println("...."+sum+" "+System.currentTimeMillis());
    }
}
